<?php


Route::get('/barcode/{barcode}', 'BarcodeController@index')->name('barcode');
//微信服务端
Route::any('/wechat', 'WechatController@serve');
Route::get('user/{hashid}/qrcode','UserController@qrcode')->name('user.qrcode')->middleware('wechat');
Route::middleware(['wechat'])->group(function () {
    //商城首页
    Route::get('/', 'HomeController@index');
    //编辑个人信息
    Route::get('/myTeam/edit','MyTeamController@edit')->name('myTeam.edit');
    //个人中心
    Route::get('/user', 'UserController@index');
//用户分享二维码链接

    //全部商品
    Route::get('/goods', 'GoodsController@all')->name('good.all');
    //商品详情
    Route::get('goods/show/{id}', 'GoodsController@index')->name('goods.show');//手机端商品详情
    //商品
    Route::get('goods/{id}', 'GoodsController@detail');//手机端
    //加入购物车
    Route::get('/cart', 'CartController@index');//购物车页面
    Route::post('cart/getGoodsInfo/{id}', 'CartController@getGoodsInfo');//购物车页面
    Route::post('cart/add', 'CartController@store');
    Route::post('cart/settlement', 'CartController@settlement');//结算购物车
    Route::post('cart/fastSettlement', 'CartController@fastSettlement');//直接购买
    Route::post('cart/update', 'CartController@update');//修改购物车
    Route::post('cart/delete', 'CartController@destroy');//删除购物车商品
    //订单支付页面
    Route::get('/order/{orderId}', 'OrderController@index')->name('order.pay');
    //订单支付
    Route::post('/order/payfor', 'OrderController@payfor')->name('order.payfor');
    //优惠券
    Route::resource('my/coupon', 'MyCouponController');
    //收货地址
    Route::resource('my/address', 'MyAddressController');
    //我的订单
    Route::get('my/order', 'MyOrderController@index')->name('my.order');
    //ajax 请求订单
    Route::get('my/orderAjax', 'MyOrderController@orderAjax');
    //订单成功页面
    Route::get('my/order/{order}/success', 'MyOrderController@success')->name('order.success');
    //确认收货
    Route::post('my/order/{order}/received', 'MyOrderController@received')->name('orders.received');
    //取消订单
    Route::post('my/orders/{order}/cancel', 'MyOrderController@cancel');
    //退款
    Route::post('my/orders/{order}/apply_refund', 'MyOrderController@applyRefund')->name('orders.apply_refund');
    //物流状态
    Route::get('my/order/express', 'MyOrderController@express');
    Route::middleware('can:viewTeam')->group(function () {
        //我的团队页面
        Route::get('/myTeam', 'MyTeamController@index')->name('myTeam');
        //提现说明
        Route::get('/myTeam/tixian', 'MyTeamController@tixian');
        //提现页面
        Route::get('/myTeam/withdraw', 'MyTeamController@withdraw');
        //提现请求
        Route::post('/myTeam/withdraw', 'MyTeamController@withdrawStore');
        //提现详情
        Route::get('/myTeam/withdrawDetail', 'MyTeamController@withdrawDetail');
        //提现ajax提交
        Route::get('/myTeam/withdrawAjax', 'MyTeamController@withdrawAjax');
        //我的海报
        Route::get('/myTeam/poster', 'MyTeamController@poster')->middleware('Mobile');
        //我的朋友圈
        Route::get('myTeam/friends', 'MyTeamController@friends')->name('myTeam.friend');
        //我的密友
        Route::get('myTeam/friends/{level}', 'MyTeamController@levelFriends')->name('myTeam.level');
        //总收益
        Route::get('myTeam/totalProfit', 'MyTeamController@totalProfit');
        //收益列表
        Route::get('myTeam/profit/{type}', 'MyTeamController@profit')->name('myTeam.profit');
        //ajax 收益
        Route::get('myTeam/ajaxProfit', 'MyTeamController@ajaxProfit')->name('myTeam.ajaxProfit');
    });
});
Route::get('/user/bindMobile', 'UserController@bindMobile')->middleware('wechat')->name('user.bindMobile');//绑定手机页面
Route::post('/user/bindMobile', 'UserController@bindMobileDo')->middleware('wechat');
Route::post('/user/sms', 'UserController@sms');
//微信支付通知
Route::post('/wechat/notify', 'OrderController@wechatNotify');
//阿里支付web页面
Route::get('/alipay', 'OrderController@alipayWeb');
//阿里支付
Route::post('/alipay/notify', 'OrderController@alipayNotify');
//通过普通登陆
Route::get('/login', 'LoginController@index')->name('login');
//普通登陆提交
Route::post('/login', 'LoginController@login');

